<?php 
	echo $this->element('reportcss');  
if(empty($report)){?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2>领军人才统计报表</h2>
	</div>
    <?php
  		$url_explode=explode("group=", $_SERVER["QUERY_STRING"]);
    	echo '<div class="right back_btn">';
		echo $html->link("导出报表","/reports/talentreport/1?group=".$url_explode[1]);
		echo '</div>';
	?> 
	<?php echo $this->element('reportgroup'); ?>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
        <div class="items_list">
<?php }?>
			<?php 
        		if(!empty($report)){
        			echo "<div align='center'><h3>领军人才统计报表</h3></div>";
        		}
        	?>
        	<table border='1'>
            	<tr>
            		<th>序号</th>
                    <th>单位名称</th>
                    <th>模块</th>
		 			<th>人才姓名</th>
		 			<th>性别</th>
		 			<th>出生年月</th>
		 			<th>国籍</th>
		 			<th>项目名称</th>
		 			<th>毕业院校</th>
		 			<th>学历学位</th>
		 			<th>注册时间</th>
		 			<th>注册资金(万元)</th>
		 			<th>常熟市扶持资金(万元)</th>
		 			<th>实收资本(万元)</th>
		 			<th>领军人才扶持资金(万元)</th>
		 			<th>实收资本(万元)</th>
		 			<th>备注</th>
                </tr>
		 		<?php 
		 			$i = 1;
					foreach($companys as $company)
					{
						$cname = $company["SearchCompany"]["company_name"];//单位名称
		 				$contact = $company["SearchCompany"]["contact"];//人才姓名
		 				$sex = $company["SearchCompany"]["sex"];//性别
		 				$groupname=$grouplist[$company["SearchCompany"]["groupid"]];
		 				
		 				if($sex == 0)
		 					$sex = "男";
		 				else 
		 					$sex = "女";
		 				$birthday = "";
		 				$bir = $company["SearchCompany"]["birthday"];
		 				if($bir)
		 					$birthday = date("Y-m-d",strtotime($bir));//出生年月
		 				$nation = $company["SearchCompany"]["nation"];//国籍
		 				$pid = $company["SearchCompany"]["pid"];
		 				classregistry::init('Project')->unbindModel(array ('hasMany' => array ('Attachment','pros_cvalue','Informationfrom','Competence'),'belongsTo' => array ('phase_cvalue','reg_cvalue','reg_decl_cvalue','first_owners','second_owners')));
		 				$pname = "";
		 				$where = "Project.id = '$pid'";
		 				$project = classregistry::init('Project')->findAll($where,"Project.project_name");
		 				if($project)
		 					$pname = $project[0]["Project"]["project_name"];//项目名称
		 				$graduate_school = $company["SearchCompany"]["graduate_school"];//毕业院校
		 				$education = "";
		 				$edu = $company["SearchCompany"]["education"];
		 				if(!empty($edu))
		 					$education = $education_array[$edu];//学历学位
		 				$reg_time = date("Y-m-d",strtotime($company["SearchCompany"]["reg_time"]));//注册时间
		 				$cap_type = $company["SearchCompany"]["cap_type"];
		 				$capital = $company["SearchCompany"]["capital"];
		 				if($cap_type == 1)
		 					$capital .= "美元";
		 				$municipal_capital = $company["SearchCompany"]["municipal_capital"];//常熟市扶持资金
		 				$municipal_cash = $company["SearchCompany"]["municipal_cash"];//已兑现
		 				$custp_capital = $company["SearchCompany"]["custp_capital"];//科创园扶持资金
		 				$custp_cash = $company["SearchCompany"]["custp_cash"];//已兑现
		 				
		 				//人才信息
		 				$talents = $company["CompTalent"];
		 				$statement = "";
		 				if($talents)
		 				{
		 					foreach($talents as $talent)
			 				{
			 					$declare_time = date("Y",strtotime($talent["declare_time"]));//申报的年份
			 					$tvalue=$talent['type_id'];
								classregistry::init('Talstack')->tname="";
								classregistry::init('Talstack')->showtname($tvalue);
								$tname=rtrim(classregistry::init('Talstack')->tname,"/");
								$beizhu = $declare_time.$tname;
								$statement .= $beizhu."<br/>";
			 				} 
			 				$statement = rtrim($statement,"<br/>");//备注
			 				
			 				echo "<tr>";
			 				echo "<td align='center' >".$str->formatCell($i)."</td>";
			 				echo "<td align='center' >".$str->formatCell($cname)."</td>";
			 				echo "<td align='center' >".$str->formatCell($groupname)."</td>";
			 				echo "<td align='center' >".$str->formatCell($contact)."</td>";
			 				echo "<td align='center' >".$str->formatCell($sex)."</td>";
			 				echo "<td align='center' >".$str->formatCell($birthday)."</td>";
			 				echo "<td align='center' >".$str->formatCell($nation)."</td>";
			 				echo "<td align='center' >".$str->formatCell($pname)."</td>";
			 				echo "<td align='center' >".$str->formatCell($graduate_school)."</td>";
			 				echo "<td align='center' >".$str->formatCell($education)."</td>";
			 				echo "<td align='center' >".$str->formatCell($reg_time)."</td>";
			 				echo "<td align='center' >".$str->formatCell($capital)."</td>";
			 				echo "<td align='center' >".$str->formatCell($municipal_capital)."</td>"; 
			 				echo "<td align='center' >".$str->formatCell($municipal_cash)."</td>";
			 				echo "<td align='center' >".$str->formatCell($custp_capital)."</td>";
			 				echo "<td align='center' >".$str->formatCell($custp_cash)."</td>";
			 				echo "<td align='center' >".$str->formatCell($statement)."</td>";
			 				
			 				echo "</tr>";
			 				$i++;
		 				}
					}
		 		?>
            </table>
<?php if(empty($report)){?>
		</div>
    </div>
</div>
<?php }?>
